﻿namespace RefactorLoop
{
    using System;

    public class Program
    {
        public static void Main(string[] args)
        {
            string[] array = InitialiseArray();
            Console.Write("Enter searched value: ");
            string expectedValue = Console.ReadLine();

            bool isExpectedValue = false;
            int arrayLength = array.Length;
            int valueFoundIndex = -1;
            for (int i = 0; i < arrayLength; i++)
            {
                string currentValue = array[i];
                Console.WriteLine(currentValue);
                if (i % 10 == 0 && currentValue == expectedValue)
                {
                    isExpectedValue = true;
                    valueFoundIndex = i;
                    break;
                }
            }

            if (isExpectedValue)
            {
                Console.WriteLine("Value Found on index {0}", valueFoundIndex);
            }
        }
  
        private static string[] InitialiseArray()
        {
            Console.Write("Enter values number: ");
            int arrayLength = int.Parse(Console.ReadLine());
            string[] array = new string[arrayLength];
            for (int i = 0; i < arrayLength; i++)
            {
                Console.Write("Enter value {0}: ", i + 1);
                array[i] = Console.ReadLine();
            }

            return array;
        }
    }
}